<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>

        // var height = document.documentElement.clientHeight ;

        // 低版本IE
        // var  height = document.body.clientHeight ;

        // 短路赋值
        var height = document.documentElement.clientHeight || document.body.clientHeight ;


        var root = document.documentElement || document.body ;

        // 可视高度
        var h = root.clientHeight ;

        // 实际高度
        var h2 = root.scrollHeight ;


        // 页面被卷去的高度
        var h3 = root.scrollTop ;

    </script>
    
</body>
</html>